<?php
namespace app\controller;

use app\BaseController;
use gizwits\src\Routers\App\CommonSchedulerOpt;
use gizwits\src\Routers\App\SchedulerOpt;
use gizwits\src\Routers\App\Users;
use ioc\interfaces\Log;
use ioc\logic\User;
use ioc\services\DatabaseLogService;
use ioc\services\FileLogService;
use ioc\src\Ioc;

class Index extends BaseController
{
    public function index()
    {
//        //是否被缓存
//        dump(opcache_invalidate('/data/application/code/test/public/index.php'));
//        //查看缓存状态
//        dump(opcache_get_status());
//        file_put_contents()
        /*
        eval("file_put_contents('/data/codelogs/test/a.txt', '23132');");
        $s = microtime(true);
        $type = request()->get('type');
        $num = 100000;
        $tmp = [];
        $day = date('YmdHis');
        for ($i = 0; $i < $num; $i++) {
            $rnad = rand(100000, 999999);
            $tmp[] = "SL{$day}{$rnad}";
        }
        dump(count($tmp));
        $tmp2 = array_unique($tmp);
        dump(count($tmp2));
        $e = microtime(true);
        $run_time = $e - $s;
        file_put_contents("/data/codelogs/test/{$type}.txt", "{$num}: {$run_time}".PHP_EOL, FILE_APPEND);
        dump($run_time);

        $users = new Users();
//        $users->get();

//        dump($this->app->f::test());
//        dump(env('APP_ENV'));
        */

//        $schedulerOpt = new CommonSchedulerOpt();
//        $schedulerOpt->_id(1)->delete();
//
//        $schedulerOpt1 = new SchedulerOpt();
//        $schedulerOpt1->_id(100)->_did(200)->delete();
//        dump($schedulerOpt1->getRouter());

        /**
        $user = new Users();

        $ret = $user->_username('sinhang')->_password('!A123456a')
//            ->_email('mercury@jozhi.com.cn')
//            ->_lang('zh-cn')
            ->post();
        dump($ret);
**/
//        $ioc = new Ioc();
//        $ioc->bind(Log::class, FileLogService::class);
//        $ioc->bind('user', User::class);
//        //  执行User::class实例化操作
//        $user = $ioc->make('user');
//        $user->login();


        return \Test::add('/', function ($a, $b, $c) {
            return $a + $b + $c;
        });


        //return '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:) 2020新春快乐</h1><p> ThinkPHP V' . \think\facade\App::version() . '<br/><span style="font-size:30px;">14载初心不改 - 你值得信赖的PHP框架</span></p><span style="font-size:25px;">[ V6.0 版本由 <a href="https://www.yisu.com/" target="yisu">亿速云</a> 独家赞助发布 ]</span></div>';
    }

    public function hello($name = 'ThinkPHP6')
    {
        return 'hello,' . $name;
    }

    public function haha()
    {
        $func = function () {

        };

        $bindTo = new \BindTo();
        $bind = new \Bind();
        $bindTo1 = $func->bindTo($bindTo);
        $bind1 = $func->bind(function () {

        }, $bind);

        $bindTo1->haha();

        //$bindTo->
    }
}
